// 当前对局会话信息
import {defineStore} from 'pinia'
import {ref} from "vue";

export const gameFlowSessionStore=defineStore('gameFlowSessionStore',()=>{
    {
        const gamePhase=ref('');
        const champSelectSession = ref({});
        const lobby = ref({});
        const gameFlow = ref({});

        const setGamePhase=(phase)=>{
            if(statusMap.get(phase)){
                gamePhase.value = statusMap.get(phase);
            }
        };

        const setChampSelectSession=(champSession)=>{
            champSelectSession.value = champSession;
        }

        const setLobby=(data)=>{
            lobby.value = data;
        }

        const setGameFlow=(data)=>{
            gameFlow.value = data;
        }

        return {
            gamePhase,setGamePhase,
            champSelectSession,setChampSelectSession,
            lobby,setLobby,
            gameFlow,setGameFlow,
        }
    }
})




//这里将当前游戏状态进行粗略分
// 1. 在大厅
// 2. 在房间
// 3. 选英雄
// 4. 游戏中
// 5. 结算页面

export const hall = 'hall';//大厅
export const lobby = 'lobby';//房间
export const championSelect = 'championSelect';//英雄选择中
export const gaming = 'gaming';//游戏中
export const settle = 'settle';//结算



const statusMap = new Map();
statusMap.set('None',hall)
statusMap.set('Lobby',lobby)
statusMap.set('ChampSelect',championSelect)
statusMap.set('InProgress',gaming)
statusMap.set('PreEndOfGame',settle)